
import os, platform, logging

#we have module
print type(os)
#we have module
print type(platform)
#we have module
print type(logging)

if platform.platform().startswith('Windows'):

    print os.getenv('HOMEDRIVE')
    print os.getenv('HOMEPATH')

    #os.path is a module!
    print type(os.path)
    logging_file = os.path.join(os.getenv('HOMEDRIVE'), os.getenv('HOMEPATH'), 'test.log')

else:
    logging_file = os.path.join(os.getenv('HOME'), os.getenv('HOMEPATH'), 'test.log')

print "Create log", logging_file

'''Format	Description
%(name)s	Name of the logger (logging channel).
%(levelname)s	Text logging level for the message ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
%(asctime)s	Human-readable time when the LogRecord was created. By default this is of the form ``2003-07-08 16:49:45,896'' (the numbers after the comma are millisecond portion of the time).
%(message)s	The logged message.'''

logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s : %(levelname)s : %(message)s',
    filename = logging_file,
    filemode = 'w',
)

logging.debug("Start programme")
logging.info("what happens now")
logging.warning("program warning")
